<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<body class="laytp-container">
<div id="opt_nav">
</div>

<div class="layui-card" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">工程名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">工程负责人</label>
                        <div class="layui-input-block">
                            <input type="text" name="gofuer" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">办事处</label>
                        <div class="layui-input-block">
                            <div id="gui_unit" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">合同编号</label>
                        <div class="layui-input-block">
                            <input type="text" name="shinumber" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">资质要求</label>
                        <div class="layui-input-block">
                            <input type="text" name="gongzi" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">项目内容</label>
                        <div class="layui-input-block">
                            <input type="text" name="gongnei" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">发包人名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="jiaer" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">中标日期</label>
                        <div class="layui-input-block">
                            <input type="text" readonly name="windt" placeholder="请输入" autocomplete="off" class="layui-input bdate_sea_range_ymd">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
<!--                                <div id="search_open" onclick="toggle_search()">-->
<!--                                    <i class="layui-icon layui-icon-down"></i>展开-->
<!--                                </div>-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('查看','{{d.LAY_TABLE_INDEX}}')">查看</a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
    </div>
</script>
<script>




    var currButAuth, currTabData;
    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;


        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });


        setSouTableExport('工程档案一览表');
        var mytable = table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_doss_lan_list),where: {}, page: true, height: 'full-140'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text
            ,parseData: function (res) {
                currButAuth = res.data.butauth;
                tableButShow(currButAuth);

                xmselect_dan('gui_unit', res.data.gui_unit, res.data.is_gui_unit, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.data.total,
                    "data": res.data.data.data
                };
            }
            , cols: [[
                {type:'numbers',title:'序号',fixed:'left',rowspan:2}
                ,{field:'gofuerjitel',title:'工程负责人及联系电话',rowspan:2,fixed:'left'}
                ,{field: 'gui_unit_name', title: '办事处名称',fixed:'left',rowspan:2}
                ,{field:'',title:'合同编号',rowspan:2,fixed:'left',templet: function(d){
                    if(d.shiinfo){
                        return '<span class="colorlan" onclick="openPage(\'../contract_shi/show.php?id='+d.shiinfo.id+'\')">'+d.shiinfo.number+'</span>';
                    }
                    return "";
                }}
                ,{field:'name',title:'工程名称',fixed:'left',rowspan:2,templet: function(d){
                        return '<span class="colorlan" onclick="openPage(\'../engin/show.php?id='+d.id+'\')">'+d.name+'</span>';
                    }}
                ,{field: 'gongzi', title: '资质要求',rowspan:2}
                ,{field: 'gongnei', title: '项目内容',rowspan:2}
                ,{field: 'jiaer', title: '发包人名称',rowspan:2}
                ,{field:'',title:'技术负责人',rowspan:2,templet: function(d){
                    if(d.cert_ji){
                        return '<span class="colorlan" onclick="openPage(\'../cert/show.php?id='+d.cert_ji.certid+'\')">'+d.cert_ji.personname+'</span>';
                    }
                    return "";
                }}
                ,{field:'',title:'项目经理',rowspan:2,templet: function(d){
                    if(d.cert_xiang){
                        return '<span class="colorlan" onclick="openPage(\'../cert/show.php?id='+d.cert_xiang.certid+'\')">'+d.cert_xiang.personname+'</span>';
                    }
                    return "";
                }}
                ,{field:'',title:'招标代理公司名称',rowspan:2,templet: function(d){
                    if(d.bidinfo){
                        return d.bidinfo.zhao_unit;
                    }
                    return "";
                }}
                ,{field:'',title:'开标日期',rowspan:2,templet: function(d){
                        if(d.bidinfo){
                            return d.bidinfo.kaidt;
                        }
                        return "";
                    }}
                ,{field: 'windt', title: '中标日期',rowspan:2}
                ,{field: 'winfee', title: '中标金额(元)',rowspan:2}
                ,{field: 'shijiefee', title: '结算金额(元)',rowspan:2}
                ,{field:'',title:'开竣工日期',rowspan:2,templet: function(d){
                    if(d.shiinfo){
                        return d.shiinfo.startdt+' 至 '+d.shiinfo.enddt;
                    }
                    return "";
                }}
                ,{field: 'shigongqi', title: '工期(日历天)',rowspan:2}
                ,{field:'',title:'签订合同日期',rowspan:2,templet: function(d){
                        if(d.shiinfo){
                            return d.shiinfo.qiandt;
                        }
                        return "";
                    }}
                ,{field: 'shixuzheng', title: '施工许可证',rowspan:2}
                ,{field: 'zhongbeibiao', title: '中标备案表',rowspan:2}
                ,{field:'',title:'四库一平台业绩录入',rowspan:2,templet: function(d){
                        if(d.bidinfo){
                            return d.bidinfo.islu;
                        }
                        return "无";
                    }}
                ,{field: 'gongdang', title: '建筑施工项目安全生产标准化考评',rowspan:2}
                ,{field: 'zhurenjiang', title: '工程主要人员奖项',rowspan:2}
                ,{field: '', title: '项目专用章',colspan:2,align:'center'}
                ,{field: '', title: '保险类型',colspan:3,align:'center'}
                ,{field: '', title: '保函',colspan:3,align:'center'}
                ,{field: '', title: '农民工工资专户',colspan:2,align:'center'}
                ,{field: '', title: '监管账户',colspan:2,align:'center'}
                ,{field: '', title: '施工资料收集情况',colspan:7,align:'center'}
                ,{field: '', title: '投标文件电子版',colspan:4,align:'center'}
            ],
            [
                {field: 'zhi_have', title: '有/无'}
                ,{field: 'zhi_shou', title: '收回情况'}

                ,{field: 'nonglvxian', title: '农民工工资支付履约保证保险'}
                ,{field: 'gongshangxian', title: '工程商业险'}
                ,{field: 'xiangshangxian', title: '项目工伤保险'}

                ,{field: 'yufubao', title: '预付款保函'}
                ,{field: 'lvbao', title: '履约保函'}
                ,{field: 'nonggongbao', title: '农民工工资保函'}

                ,{field: 'nongkai', title: '是否开设'}
                ,{field: 'nongqi', title: '是否启用'}

                ,{field: 'jiankai', title: '是否开设'}
                ,{field: 'jianqi', title: '是否启用'}

                ,{field: 'zhongtongzhi', title: '中标通知书'}
                ,{field: 'jiangongtong', title: '建设工程施工合同'}
                ,{field: 'kaibao', title: '开工报告'}
                ,{field: 'junbao', title: '竣工报告'}
                ,{field: 'junyan', title: '竣工验收报告'}
                ,{field: 'juntuzhi', title: '竣工图纸'}
                ,{field: 'jieshen', title: '结算审核报告'}

                ,{field: 'files_49', title: '招标文件'}
                ,{field: 'files_50', title: '投标文件'}
                ,{field: 'files_130', title: '预算文件'}
                ,{field: 'files_131', title: '施工图纸'}
            ]]
            , done: function (res) {
                soulTable.render(this);

                currTabData = res.data;
                $.each(currTabData, function(index,item){
                    var chk = $('tr[data-index=' + item.LAY_TABLE_INDEX + '] .tab-list-authbut');
                    for (var key in currButAuth) {
                        if(currButAuth[key].pagetype === 0 || currButAuth[key].pagetype === 1){
                            chk.append(' <a ' +
                                'href="javascript:;" ' +
                                'class="bar_opt layui-hide" ' +
                                'lay-event="search" ' +
                                'data-butname="'+currButAuth[key].butname+'" ' +
                                'data-title="'+currButAuth[key].title+'" ' +
                                'onclick="auth_but_func_'+currButAuth[key].butname+'(\''+currButAuth[key].title+'\', '+index+')"' +
                                '>'+currButAuth[key].title+'' +
                                '</a>');
                        }
                    }
                });
                show_tab_but(currTabData);
            }
        });


        listTableSearch(form, table);
    });

</script>
</body>
</html>
